//
//  XMLoadUserInfoTool.m
//  XMWeibo
//
//  Created by chi on 14-8-30.
//  Copyright (c) 2014年 xiaoming. All rights reserved.
//

#import "XMLoadUserInfoTool.h"
#import "XMHttpTool.h"

@implementation XMLoadUserInfoTool

/**
 *  http加载微博用户数据
 *
 *  @param params  请求参数
 *  @param success 成功回调block
 *  @param failure 失败回调block
 */
+ (void)httpLoadUserInfoWithParams:(XMHttpLoadUserInfoParams *)params success:(void (^)(XMHttpLoadUserInfoResult *))success failure:(void (^)(NSError *))failure
{
    [XMHttpTool httpGetWithURL:k_users_show params:params.keyValues success:^(id responseObject) {
        // 请求成功
        XMHttpLoadUserInfoResult *result = [XMHttpLoadUserInfoResult objectWithKeyValues:responseObject];
        result.userDescription = responseObject[@"description"];
        success(result);
        
    } failure:^(NSError *error) {
        // 请求失败
        failure(error);
    }];
}

/**
 *  http获取某个用户的各种消息未读数
 *
 *  @param params  请求参数
 *  @param success 成功回调block
 *  @param failure 失败回调block
 */
+ (void)httpLoadUserUnreadCountWithParams:(XMHttpLoadUserInfoParams*)params success:(void(^) (XMHttpLoadUnreadCountResult*result))success failure:(void(^) (NSError *error))failure
{
    [XMHttpTool httpGetWithURL:k_remind_unread_count params:params.keyValues success:^(id responseObject) {
        // 请求成功
        XMHttpLoadUnreadCountResult *result = [XMHttpLoadUnreadCountResult objectWithKeyValues:responseObject];
        success(result);
        
    } failure:^(NSError *error) {
        // 请求失败
        failure(error);
    }];
}


@end
